using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Infragistics.Win.UltraWinExplorerBar;
using Infragistics.Win.UltraWinTree;
using Infragistics.Win.UltraWinToolbars;
namespace ELS.Configuration.UserInterface
{
	/// <summary>
	/// Summary description for MainForm.
	/// </summary>
	public class MainForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Splitter splitter1;
		private System.Windows.Forms.ImageList imageList1;
		private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1;
		private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _MainForm_Toolbars_Dock_Area_Top;
		private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _MainForm_Toolbars_Dock_Area_Bottom;
		private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _MainForm_Toolbars_Dock_Area_Left;
		private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _MainForm_Toolbars_Dock_Area_Right;
		private Infragistics.Win.UltraWinTabControl.UltraTabControl ultraTabControl1;
		private Infragistics.Win.UltraWinTabControl.UltraTabSharedControlsPage ultraTabSharedControlsPage1;
		private Infragistics.Win.UltraWinTabControl.UltraTabPageControl ultraTabPageControl1;
		private Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar explorerBar;
		private Infragistics.Win.UltraWinTabControl.UltraTabPageControl ultraTabPageControl2;
		private Infragistics.Win.UltraWinTree.UltraTree bottomNavTree;
		private Infragistics.Win.UltraWinTree.UltraTree leftNavTree;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem mnuItemAddConfigSection;
		private System.Windows.Forms.MenuItem mnuItemAddConfigProperty;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.MenuItem mnuItemDelete;
		private System.Windows.Forms.MenuItem mnuItemModify;
		private System.Windows.Forms.MenuItem mnuNew;
		private System.Windows.Forms.ContextMenu contextMenu2;
		private System.Windows.Forms.MenuItem mnuInsertConfigSection;
		private System.Windows.Forms.MenuItem mnuDeleteConfigItem;
		private ConfigurationSection _currentSection = null;
		private System.Windows.Forms.ListView listView;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		private System.Windows.Forms.Splitter splitter2;
		private Configuration _currentConfiguration = null;
		UltraTreeNode _rootNode = null;
		private ArrayList _pathsVisited = null;

		public MainForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			this.Load+=new EventHandler(MainForm_Load);
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
            Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
            Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
            Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
            Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinTree.UltraTreeColumnSet ultraTreeColumnSet2 = new Infragistics.Win.UltraWinTree.UltraTreeColumnSet();
            Infragistics.Win.UltraWinToolbars.OptionSet optionSet1 = new Infragistics.Win.UltraWinToolbars.OptionSet("Folders");
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar1");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("File");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Edit");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool3 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("View");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool4 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Tools");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool5 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Help");
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar2 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar2");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool6 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Back");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool7 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Forward");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Up");
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar3 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar3");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Full Name");
            Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool1 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("cboFullName");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Go");
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar4 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar4");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("btnDev");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("QualityAssurance");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Staging");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Production");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool8 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("File");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Close");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool9 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Edit");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool10 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("View");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool11 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Tools");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool12 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Help");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool13 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Back");
            Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.ListTool listTool1 = new Infragistics.Win.UltraWinToolbars.ListTool("BackList");
            Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool14 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("Forward");
            Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("ForwardList");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Up");
            Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Search");
            Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Go");
            Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.ListTool listTool3 = new Infragistics.Win.UltraWinToolbars.ListTool("BackList");
            Infragistics.Win.UltraWinToolbars.ListTool listTool4 = new Infragistics.Win.UltraWinToolbars.ListTool("ForwardList");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Close");
            Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool2 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("cboFullName");
            Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList(0);
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("btnDev");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("QualityAssurance");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Staging");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool16 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Production");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool17 = new Infragistics.Win.UltraWinToolbars.ButtonTool("Full Name");
            Infragistics.Win.UltraWinTabControl.UltraTab ultraTab1 = new Infragistics.Win.UltraWinTabControl.UltraTab();
            Infragistics.Win.UltraWinTabControl.UltraTab ultraTab2 = new Infragistics.Win.UltraWinTabControl.UltraTab();
            Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinTree.UltraTreeColumnSet ultraTreeColumnSet1 = new Infragistics.Win.UltraWinTree.UltraTreeColumnSet();
            this.ultraTabPageControl1 = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();
            this.explorerBar = new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.ultraTabPageControl2 = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();
            this.leftNavTree = new Infragistics.Win.UltraWinTree.UltraTree();
            this.contextMenu2 = new System.Windows.Forms.ContextMenu();
            this.mnuInsertConfigSection = new System.Windows.Forms.MenuItem();
            this.mnuDeleteConfigItem = new System.Windows.Forms.MenuItem();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.mnuItemModify = new System.Windows.Forms.MenuItem();
            this.mnuItemDelete = new System.Windows.Forms.MenuItem();
            this.mnuNew = new System.Windows.Forms.MenuItem();
            this.mnuItemAddConfigSection = new System.Windows.Forms.MenuItem();
            this.mnuItemAddConfigProperty = new System.Windows.Forms.MenuItem();
            this.splitter1 = new System.Windows.Forms.Splitter();
            this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
            this._MainForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            this._MainForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            this._MainForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            this._MainForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            this.ultraTabControl1 = new Infragistics.Win.UltraWinTabControl.UltraTabControl();
            this.ultraTabSharedControlsPage1 = new Infragistics.Win.UltraWinTabControl.UltraTabSharedControlsPage();
            this.bottomNavTree = new Infragistics.Win.UltraWinTree.UltraTree();
            this.listView = new System.Windows.Forms.ListView();
            this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
            this.splitter2 = new System.Windows.Forms.Splitter();
            this.ultraTabPageControl1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.explorerBar)).BeginInit();
            this.ultraTabPageControl2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.leftNavTree)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).BeginInit();
            this.ultraTabControl1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.bottomNavTree)).BeginInit();
            this.SuspendLayout();
            // 
            // ultraTabPageControl1
            // 
            this.ultraTabPageControl1.Controls.Add(this.explorerBar);
            this.ultraTabPageControl1.Location = new System.Drawing.Point(1, 1);
            this.ultraTabPageControl1.Name = "ultraTabPageControl1";
            this.ultraTabPageControl1.Size = new System.Drawing.Size(204, 559);
            // 
            // explorerBar
            // 
            this.explorerBar.BorderStyle = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
            this.explorerBar.ColumnCount = 2;
            this.ultraToolbarsManager1.SetContextMenuUltra(this.explorerBar, "Insert Configuration Section");
            this.explorerBar.Dock = System.Windows.Forms.DockStyle.Fill;
            this.explorerBar.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            this.explorerBar.GroupSettings.Style = Infragistics.Win.UltraWinExplorerBar.GroupStyle.SmallImagesWithText;
            this.explorerBar.ImageListSmall = this.imageList1;
            appearance8.Image = ((object)(resources.GetObject("appearance8.Image")));
            this.explorerBar.ItemSettings.AppearancesLarge.Appearance = appearance8;
            appearance9.Image = 2;
            this.explorerBar.ItemSettings.AppearancesSmall.ActiveAppearance = appearance9;
            appearance10.Image = 1;
            this.explorerBar.ItemSettings.AppearancesSmall.Appearance = appearance10;
            appearance11.Image = 2;
            this.explorerBar.ItemSettings.AppearancesSmall.CheckedAppearance = appearance11;
            appearance12.Image = 3;
            this.explorerBar.ItemSettings.AppearancesSmall.HotTrackAppearance = appearance12;
            this.explorerBar.ItemSettings.HotTrackStyle = Infragistics.Win.UltraWinExplorerBar.ItemHotTrackStyle.NoHighlight;
            this.explorerBar.Location = new System.Drawing.Point(0, 0);
            this.explorerBar.Margins.Top = 1;
            this.explorerBar.Name = "explorerBar";
            this.explorerBar.ShowDefaultContextMenu = false;
            this.explorerBar.Size = new System.Drawing.Size(204, 559);
            this.explorerBar.Style = Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarStyle.OutlookNavigationPane;
            this.explorerBar.TabIndex = 12;
            this.explorerBar.ViewStyle = Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarViewStyle.Office2003;
            // 
            // imageList1
            // 
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            this.imageList1.Images.SetKeyName(3, "");
            this.imageList1.Images.SetKeyName(4, "");
            this.imageList1.Images.SetKeyName(5, "");
            this.imageList1.Images.SetKeyName(6, "");
            this.imageList1.Images.SetKeyName(7, "");
            this.imageList1.Images.SetKeyName(8, "");
            this.imageList1.Images.SetKeyName(9, "");
            this.imageList1.Images.SetKeyName(10, "");
            this.imageList1.Images.SetKeyName(11, "");
            this.imageList1.Images.SetKeyName(12, "");
            this.imageList1.Images.SetKeyName(13, "");
            // 
            // ultraTabPageControl2
            // 
            this.ultraTabPageControl2.Controls.Add(this.leftNavTree);
            this.ultraTabPageControl2.Location = new System.Drawing.Point(-10000, -10000);
            this.ultraTabPageControl2.Name = "ultraTabPageControl2";
            this.ultraTabPageControl2.Size = new System.Drawing.Size(204, 559);
            // 
            // leftNavTree
            // 
            appearance2.Image = 8;
            this.leftNavTree.Appearance = appearance2;
            this.leftNavTree.ColumnSettings.RootColumnSet = ultraTreeColumnSet2;
            this.leftNavTree.Dock = System.Windows.Forms.DockStyle.Fill;
            this.leftNavTree.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
            this.leftNavTree.ImageList = this.imageList1;
            this.leftNavTree.Location = new System.Drawing.Point(0, 0);
            this.leftNavTree.Name = "leftNavTree";
            this.leftNavTree.Size = new System.Drawing.Size(204, 559);
            this.leftNavTree.TabIndex = 19;
            // 
            // contextMenu2
            // 
            this.contextMenu2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.mnuInsertConfigSection,
            this.mnuDeleteConfigItem});
            this.contextMenu2.Popup += new System.EventHandler(this.contextMenu2_Popup);
            // 
            // mnuInsertConfigSection
            // 
            this.mnuInsertConfigSection.Index = 0;
            this.mnuInsertConfigSection.Text = "Insert Configuration Section";
            this.mnuInsertConfigSection.Click += new System.EventHandler(this.mnuInsertConfigSection_Click);
            // 
            // mnuDeleteConfigItem
            // 
            this.mnuDeleteConfigItem.Index = 1;
            this.mnuDeleteConfigItem.Text = "Delete Configuration Section";
            // 
            // contextMenu1
            // 
            this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.mnuItemModify,
            this.mnuItemDelete,
            this.mnuNew});
            this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup);
            // 
            // mnuItemModify
            // 
            this.mnuItemModify.Index = 0;
            this.mnuItemModify.Text = "Modify";
            this.mnuItemModify.Click += new System.EventHandler(this.mnuItemModify_Click);
            // 
            // mnuItemDelete
            // 
            this.mnuItemDelete.Index = 1;
            this.mnuItemDelete.Text = "Delete";
            this.mnuItemDelete.Click += new System.EventHandler(this.mnuItemDelete_Click);
            // 
            // mnuNew
            // 
            this.mnuNew.Index = 2;
            this.mnuNew.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.mnuItemAddConfigSection,
            this.mnuItemAddConfigProperty});
            this.mnuNew.Text = "New";
            // 
            // mnuItemAddConfigSection
            // 
            this.mnuItemAddConfigSection.Index = 0;
            this.mnuItemAddConfigSection.Text = "Configuration Section";
            this.mnuItemAddConfigSection.Click += new System.EventHandler(this.mnuItemAddConfigSection_Click);
            // 
            // mnuItemAddConfigProperty
            // 
            this.mnuItemAddConfigProperty.Index = 1;
            this.mnuItemAddConfigProperty.Text = "Configuration Property";
            this.mnuItemAddConfigProperty.Click += new System.EventHandler(this.mnuItemAddConfigProperty_Click);
            // 
            // splitter1
            // 
            this.splitter1.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.splitter1.Location = new System.Drawing.Point(208, 85);
            this.splitter1.Name = "splitter1";
            this.splitter1.Size = new System.Drawing.Size(3, 585);
            this.splitter1.TabIndex = 12;
            this.splitter1.TabStop = false;
            // 
            // ultraToolbarsManager1
            // 
            this.ultraToolbarsManager1.DesignerFlags = 1;
            this.ultraToolbarsManager1.DockWithinContainer = this;
            this.ultraToolbarsManager1.ImageSizeSmall = new System.Drawing.Size(20, 20);
            this.ultraToolbarsManager1.OptionSets.Add(optionSet1);
            this.ultraToolbarsManager1.ShowFullMenusDelay = 500;
            this.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.Office2003;
            ultraToolbar1.DockedColumn = 0;
            ultraToolbar1.DockedRow = 0;
            ultraToolbar1.IsMainMenuBar = true;
            ultraToolbar1.Text = "UltraToolbar1";
            ultraToolbar1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            popupMenuTool1,
            popupMenuTool2,
            popupMenuTool3,
            popupMenuTool4,
            popupMenuTool5});
            ultraToolbar2.DockedColumn = 0;
            ultraToolbar2.DockedRow = 1;
            ultraToolbar2.FloatingLocation = new System.Drawing.Point(496, 430);
            ultraToolbar2.FloatingSize = new System.Drawing.Size(318, 28);
            ultraToolbar2.Text = "UltraToolbar2";
            popupMenuTool6.InstanceProps.Caption = "Back";
            popupMenuTool6.InstanceProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            popupMenuTool7.InstanceProps.Caption = "Forward";
            popupMenuTool7.InstanceProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            ultraToolbar2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            popupMenuTool6,
            popupMenuTool7,
            buttonTool1});
            ultraToolbar3.DockedColumn = 0;
            ultraToolbar3.DockedRow = 2;
            ultraToolbar3.FloatingLocation = new System.Drawing.Point(324, 311);
            ultraToolbar3.FloatingSize = new System.Drawing.Size(701, 28);
            ultraToolbar3.Text = "UltraToolbar3";
            comboBoxTool1.InstanceProps.Width = 440;
            ultraToolbar3.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            buttonTool2,
            comboBoxTool1,
            buttonTool3});
            ultraToolbar4.DockedColumn = 1;
            ultraToolbar4.DockedRow = 1;
            ultraToolbar4.FloatingLocation = new System.Drawing.Point(295, 429);
            ultraToolbar4.FloatingSize = new System.Drawing.Size(295, 50);
            ultraToolbar4.Text = "UltraToolbar4";
            ultraToolbar4.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            buttonTool4,
            buttonTool5,
            buttonTool6,
            buttonTool7});
            this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
            ultraToolbar1,
            ultraToolbar2,
            ultraToolbar3,
            ultraToolbar4});
            popupMenuTool8.SharedProps.Caption = "&File";
            popupMenuTool8.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            buttonTool8});
            popupMenuTool9.SharedProps.Caption = "&Edit";
            popupMenuTool10.SharedProps.Caption = "&View";
            popupMenuTool11.SharedProps.Caption = "&Tools";
            popupMenuTool12.SharedProps.Caption = "&Help";
            popupMenuTool13.DropDownArrowStyle = Infragistics.Win.UltraWinToolbars.DropDownArrowStyle.Segmented;
            popupMenuTool13.InstanceProps.Caption = "Back";
            popupMenuTool13.InstanceProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            appearance3.Image = ((object)(resources.GetObject("appearance3.Image")));
            popupMenuTool13.SharedProps.AppearancesSmall.Appearance = appearance3;
            popupMenuTool13.SharedProps.Caption = "Back";
            popupMenuTool13.SharedProps.Enabled = false;
            popupMenuTool13.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            listTool1});
            popupMenuTool14.DropDownArrowStyle = Infragistics.Win.UltraWinToolbars.DropDownArrowStyle.Segmented;
            popupMenuTool14.InstanceProps.Caption = "Forward";
            popupMenuTool14.InstanceProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            appearance4.Image = ((object)(resources.GetObject("appearance4.Image")));
            popupMenuTool14.SharedProps.AppearancesSmall.Appearance = appearance4;
            popupMenuTool14.SharedProps.CustomizerCaption = "Forward";
            popupMenuTool14.SharedProps.Enabled = false;
            popupMenuTool14.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            listTool2});
            appearance5.Image = ((object)(resources.GetObject("appearance5.Image")));
            buttonTool9.SharedProps.AppearancesSmall.Appearance = appearance5;
            buttonTool9.SharedProps.Caption = "Up";
            appearance6.Image = ((object)(resources.GetObject("appearance6.Image")));
            buttonTool10.SharedProps.AppearancesSmall.Appearance = appearance6;
            buttonTool10.SharedProps.Caption = "Search";
            buttonTool10.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            appearance7.Image = ((object)(resources.GetObject("appearance7.Image")));
            buttonTool11.SharedProps.AppearancesSmall.Appearance = appearance7;
            buttonTool11.SharedProps.Caption = "Go";
            buttonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            listTool3.DisplayCheckmark = false;
            listTool3.SharedProps.Caption = "BackList";
            listTool4.DisplayCheckmark = false;
            listTool4.SharedProps.Caption = "ForwardList";
            buttonTool12.SharedProps.Caption = "Close";
            comboBoxTool2.AutoComplete = true;
            comboBoxTool2.DropDownStyle = Infragistics.Win.DropDownStyle.DropDown;
            comboBoxTool2.SharedProps.AllowMultipleInstances = false;
            comboBoxTool2.SharedProps.Caption = "Full N&ame";
            comboBoxTool2.ValueList = valueList1;
            buttonTool13.SharedProps.Caption = "&Development";
            buttonTool13.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool14.SharedProps.Caption = "&Quality Assurance";
            buttonTool14.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool15.SharedProps.Caption = "Sta&ging";
            buttonTool15.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool16.SharedProps.Caption = "&Production";
            buttonTool16.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool17.SharedProps.Caption = "Full Name";
            buttonTool17.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            popupMenuTool8,
            popupMenuTool9,
            popupMenuTool10,
            popupMenuTool11,
            popupMenuTool12,
            popupMenuTool13,
            popupMenuTool14,
            buttonTool9,
            buttonTool10,
            buttonTool11,
            listTool3,
            listTool4,
            buttonTool12,
            comboBoxTool2,
            buttonTool13,
            buttonTool14,
            buttonTool15,
            buttonTool16,
            buttonTool17});
            // 
            // _MainForm_Toolbars_Dock_Area_Top
            // 
            this._MainForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
            this._MainForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(190)))), ((int)(((byte)(245)))));
            this._MainForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
            this._MainForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
            this._MainForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
            this._MainForm_Toolbars_Dock_Area_Top.Name = "_MainForm_Toolbars_Dock_Area_Top";
            this._MainForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(1104, 85);
            this._MainForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // _MainForm_Toolbars_Dock_Area_Bottom
            // 
            this._MainForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
            this._MainForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(190)))), ((int)(((byte)(245)))));
            this._MainForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
            this._MainForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
            this._MainForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 670);
            this._MainForm_Toolbars_Dock_Area_Bottom.Name = "_MainForm_Toolbars_Dock_Area_Bottom";
            this._MainForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(1104, 0);
            this._MainForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // _MainForm_Toolbars_Dock_Area_Left
            // 
            this._MainForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
            this._MainForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(190)))), ((int)(((byte)(245)))));
            this._MainForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
            this._MainForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
            this._MainForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 85);
            this._MainForm_Toolbars_Dock_Area_Left.Name = "_MainForm_Toolbars_Dock_Area_Left";
            this._MainForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 585);
            this._MainForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // _MainForm_Toolbars_Dock_Area_Right
            // 
            this._MainForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
            this._MainForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(190)))), ((int)(((byte)(245)))));
            this._MainForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
            this._MainForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
            this._MainForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(1104, 85);
            this._MainForm_Toolbars_Dock_Area_Right.Name = "_MainForm_Toolbars_Dock_Area_Right";
            this._MainForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 585);
            this._MainForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // ultraTabControl1
            // 
            this.ultraTabControl1.Controls.Add(this.ultraTabSharedControlsPage1);
            this.ultraTabControl1.Controls.Add(this.ultraTabPageControl1);
            this.ultraTabControl1.Controls.Add(this.ultraTabPageControl2);
            this.ultraTabControl1.Dock = System.Windows.Forms.DockStyle.Left;
            this.ultraTabControl1.Location = new System.Drawing.Point(0, 85);
            this.ultraTabControl1.Name = "ultraTabControl1";
            this.ultraTabControl1.SharedControlsPage = this.ultraTabSharedControlsPage1;
            this.ultraTabControl1.Size = new System.Drawing.Size(208, 585);
            this.ultraTabControl1.TabIndex = 30;
            this.ultraTabControl1.TabOrientation = Infragistics.Win.UltraWinTabs.TabOrientation.BottomLeft;
            ultraTab1.TabPage = this.ultraTabPageControl1;
            ultraTab1.Text = "Outlook View";
            ultraTab2.TabPage = this.ultraTabPageControl2;
            ultraTab2.Text = "Tree View";
            this.ultraTabControl1.Tabs.AddRange(new Infragistics.Win.UltraWinTabControl.UltraTab[] {
            ultraTab1,
            ultraTab2});
            // 
            // ultraTabSharedControlsPage1
            // 
            this.ultraTabSharedControlsPage1.Location = new System.Drawing.Point(-10000, -10000);
            this.ultraTabSharedControlsPage1.Name = "ultraTabSharedControlsPage1";
            this.ultraTabSharedControlsPage1.Size = new System.Drawing.Size(204, 559);
            // 
            // bottomNavTree
            // 
            appearance1.Image = 5;
            this.bottomNavTree.Appearance = appearance1;
            this.bottomNavTree.ColumnSettings.RootColumnSet = ultraTreeColumnSet1;
            this.bottomNavTree.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.bottomNavTree.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            this.bottomNavTree.ImageList = this.imageList1;
            this.bottomNavTree.Location = new System.Drawing.Point(211, 518);
            this.bottomNavTree.Name = "bottomNavTree";
            this.bottomNavTree.Size = new System.Drawing.Size(893, 152);
            this.bottomNavTree.TabIndex = 18;
            // 
            // listView
            // 
            this.listView.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2,
            this.columnHeader3});
            this.listView.ContextMenu = this.contextMenu1;
            this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
            this.listView.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
            this.listView.FullRowSelect = true;
            this.listView.GridLines = true;
            this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
            this.listView.HideSelection = false;
            this.listView.Location = new System.Drawing.Point(211, 85);
            this.listView.MultiSelect = false;
            this.listView.Name = "listView";
            this.listView.Size = new System.Drawing.Size(893, 433);
            this.listView.SmallImageList = this.imageList1;
            this.listView.TabIndex = 35;
            this.listView.UseCompatibleStateImageBehavior = false;
            this.listView.View = System.Windows.Forms.View.Details;
            // 
            // columnHeader1
            // 
            this.columnHeader1.Text = "Name";
            this.columnHeader1.Width = 200;
            // 
            // columnHeader2
            // 
            this.columnHeader2.Text = "Type";
            this.columnHeader2.Width = 200;
            // 
            // columnHeader3
            // 
            this.columnHeader3.Text = "Full Name";
            this.columnHeader3.Width = 350;
            // 
            // splitter2
            // 
            this.splitter2.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.splitter2.Location = new System.Drawing.Point(211, 515);
            this.splitter2.Name = "splitter2";
            this.splitter2.Size = new System.Drawing.Size(893, 3);
            this.splitter2.TabIndex = 36;
            this.splitter2.TabStop = false;
            // 
            // MainForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(1104, 670);
            this.Controls.Add(this.splitter2);
            this.Controls.Add(this.listView);
            this.Controls.Add(this.bottomNavTree);
            this.Controls.Add(this.splitter1);
            this.Controls.Add(this.ultraTabControl1);
            this.Controls.Add(this._MainForm_Toolbars_Dock_Area_Right);
            this.Controls.Add(this._MainForm_Toolbars_Dock_Area_Left);
            this.Controls.Add(this._MainForm_Toolbars_Dock_Area_Top);
            this.Controls.Add(this._MainForm_Toolbars_Dock_Area_Bottom);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "MainForm";
            this.Text = "Configuration Editor";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.ultraTabPageControl1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.explorerBar)).EndInit();
            this.ultraTabPageControl2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.leftNavTree)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).EndInit();
            this.ultraTabControl1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.bottomNavTree)).EndInit();
            this.ResumeLayout(false);

		}
		#endregion

		public static void Main()
		{
			Application.Run(new MainForm());
		}

		private void MainForm_Load(object sender, EventArgs e)
		{
			_pathsVisited = new ArrayList(10);
			explorerBar.ItemClick+=new ItemClickEventHandler(explorerBar_ItemClick);
			listView.DoubleClick+=new EventHandler(listView_DoubleClick);
			listView.KeyDown+=new KeyEventHandler(listView_KeyDown);
			this.ultraToolbarsManager1.Tools["Up"].ToolClick+=new ToolClickEventHandler(Up_ToolClick);
			bottomNavTree.DoubleClick+=new EventHandler(bottomNavTree_DoubleClick);
			explorerBar.Click+=new EventHandler(explorerBar_Click);
			explorerBar.ActiveGroupChanged+=new ActiveGroupChangedEventHandler(explorerBar_ActiveGroupChanged);
			leftNavTree.DoubleClick+=new EventHandler(leftNavTree_DoubleClick);

			ConfigurationManager.Instance.Initialize();
            UltraExplorerBarGroup group = null;
            leftNavTree.Nodes.Clear();
            _rootNode = leftNavTree.Nodes.Add( "Configurations" );
            foreach( Configuration configuration in ConfigurationManager.Instance.Configurations )
            {
                group = explorerBar.Groups.Add( configuration.Name, configuration.Name );
                UltraTreeNode configNode = _rootNode.Nodes.Add( configuration.Name );
                configNode.Tag = configuration;
                group.Tag = configuration;
                foreach( ConfigurationSection section in configuration.Sections )
                {
                    group.Items.Add( section.Name, section.Name );
                    UltraTreeNode node = configNode.Nodes.Add(section.Name, section.Name);
                    node.Tag = section;
                    AddSectionsToNode ( node, section.Sections );
                }
            }
            if ( explorerBar.Groups.Count > 0 )
            {
                explorerBar.Groups[0].Expanded = true;
                explorerBar.Groups[0].Active = true;
            }
		}

		private void AddSectionsToNode(UltraTreeNode node , ConfigurationSectionCollection sectionCollection)
		{
			foreach( ConfigurationSection section in sectionCollection )
			{
				UltraTreeNode subNode = node.Nodes.Add();
				subNode.Text = section.Name;
				subNode.Tag = section;
				AddSectionsToNode( subNode , section.Sections );
			}
		}

		private void explorerBar_ItemClick(object sender, ItemEventArgs e)
		{
			Configuration configuration = ConfigurationManager.Instance.Configurations [ e.Item.Group.Key ];
			LoadViewsWithDetails (  configuration.Sections[ e.Item.Key ] );
		}

		private void LoadViewsWithDetails( object dataItem )
		{
			if ( dataItem != null )
			{
				try
				{
					if ( dataItem is ConfigurationSection )
					{
						// Stop the listview from updating until we're done adding items.
						this.listView.BeginUpdate();

						// Clear the current list.
						this.listView.Items.Clear();
						
						// Stop the tree from updating until we're done adding items.
						bottomNavTree.BeginUpdate();
						
						// Clear the current nodes.
						bottomNavTree.Nodes.Clear();
						
						const int VALUE_COLUMN = 3;	

						if ( this.listView.Columns.Count > VALUE_COLUMN )
							this.listView.Columns.RemoveAt( VALUE_COLUMN );


						ConfigurationSection configSection = dataItem as ConfigurationSection;
						_currentSection = configSection;

						UltraTreeNode sectionNode = new UltraTreeNode( configSection.Name, configSection.Name);
						sectionNode.Tag = configSection;

						ConfigurationObjectBase parent = configSection.Parent;

						while ( parent != null )
						{
							UltraTreeNode node = new UltraTreeNode();
							node.Text = parent.Name;
							node.Nodes.Add( sectionNode );
							node.Tag = parent;

							sectionNode = node;
							parent = parent.Parent;
						}
						
						bottomNavTree.Nodes.Add( sectionNode )	;

						foreach( ConfigurationObjectBase section in configSection.Sections )
						{
							this.listView.Items.Add( CreateListViewItem ( section, 5 ) );
						}
						
						foreach( ConfigurationProperty configProperty in configSection.Properties )
						{
							if ( this.listView.Columns.Count <= VALUE_COLUMN )
								this.listView.Columns.Insert( 3, "Value", 200, HorizontalAlignment.Left );

							ListViewItem item = CreateListViewItem ( configProperty, 4 );
							item.SubItems.Add( configProperty.Value );
						
							this.listView.Items.Add( item );
						}
					}

					if ( dataItem is ConfigurationProperty )
					{
						ConfigurationProperty configProperty = dataItem as ConfigurationProperty;
						ConfigurationPropertyEditor form = new ConfigurationPropertyEditor( configProperty );
						if ( form.ShowDialog() == DialogResult.OK )
						{
							int selectedIndex = listView.SelectedIndices [ 0 ];
							LoadViewsWithDetails( configProperty.Parent );
							listView.Items[ selectedIndex ].Selected = true;
						}
					}
				}
				finally
				{
					// We're finished adding entries to the listview so tell the listview to update its UI.
					this.listView.EndUpdate();

					// We're finished adding entries to the tree so tell the tree to update its UI.
					bottomNavTree.EndUpdate();
					bottomNavTree.ExpandAll();
				}
			}
		}

		private ListViewItem CreateListViewItem ( ConfigurationObjectBase configObject, int imageIndex )
		{
			ListViewItem item = new ListViewItem(configObject.Name, imageIndex ) ;
			item.Tag = configObject;
			item.SubItems.Add( configObject.GetType().Name );
			item.SubItems.Add( configObject.FullName );
			return item;
		}

		private void listView_DoubleClick(object sender, EventArgs e)
		{
			if ( listView.SelectedItems.Count > 0 )
			{
				int itemIndex = listView.SelectedItems[0].Index;
				LoadViewsWithDetails ( listView.SelectedItems [ 0 ].Tag );
				SelectListViewItem( itemIndex );
			}
		}

		private void Up_ToolClick(object sender, ToolClickEventArgs e)
		{
			if ( listView.Items.Count > 0 )
			{
				ConfigurationObjectBase configObject = listView.Items [ 0 ].Tag as ConfigurationObjectBase;
				
				if ( configObject !=  null && configObject.Parent != null && 
					configObject.Parent.Parent != null && !( configObject.Parent.Parent is Configuration ))
				{
					LoadViewsWithDetails ( configObject.Parent.Parent );
					SelectFirstListViewItem();
				}
			}
		}

		private void SelectFirstListViewItem( )
		{
			SelectListViewItem( 0 );
		}

		private void SelectListViewItem( int index )
		{
			if ( listView.Items.Count > 0 ) 
			{
				if ( index >= listView.Items.Count )
					index = listView.Items.Count - 1;

				listView.Items[ index ].Selected = true;
				listView.Items[ index ].Focused = true;
			}
		}

		private void bottomNavTree_DoubleClick(object sender, EventArgs e)
		{
			if ( bottomNavTree.SelectedNodes.Count > 0 )
				LoadViewsWithDetails ( bottomNavTree.SelectedNodes[0].Tag );
		}

		private void mnuItemAddConfigSection_Click(object sender, System.EventArgs e)
		{
			if ( _currentSection != null )
			{
				string sectionName = Microsoft.VisualBasic.Interaction.InputBox("Section Name :","Edit Configuration Section",null, -1, -1 );
				if (sectionName != null && sectionName.Trim().Length > 0 && ! _currentSection.Sections.Contains (sectionName) )
				{
					_currentSection.Sections.Add( sectionName );
					LoadViewsWithDetails( _currentSection );
				}
			}
		}

		private void mnuItemAddConfigProperty_Click(object sender, System.EventArgs e)
		{
			if ( _currentSection != null )
			{
				string propertyName = Microsoft.VisualBasic.Interaction.InputBox("Property Name :","Edit Configuration Property",null, -1, -1 );
				if (propertyName != null && propertyName.Trim().Length > 0 && ! _currentSection.Properties.Contains (propertyName) )
				{
					_currentSection.Properties.Add( propertyName );
					LoadViewsWithDetails( _currentSection );
				}
			}
		}

		private void mnuItemDelete_Click(object sender, System.EventArgs e)
		{
			if ( listView.SelectedItems.Count > 0 && ConfirmValueDelete())
			{
				int itemIndex = listView.SelectedItems[0].Index;

				ConfigurationObjectBase item = listView.SelectedItems[ 0 ].Tag as ConfigurationObjectBase;
				if ( item.Parent is ConfigurationSection )
				{
					ConfigurationSection section = item.Parent as ConfigurationSection;

					if ( item is ConfigurationSection )
						section.Sections.Remove( item.Name );
					else
						section.Properties.Remove( item.Name );
				}
				else if ( item.Parent is Configuration )
				{
					Configuration configuration = item.Parent as Configuration;

					if ( item is ConfigurationSection )
						configuration.Sections.Remove( item.Name );
				}
				LoadViewsWithDetails( _currentSection );
				SelectListViewItem( itemIndex );
			}
		}

		private bool ConfirmValueDelete()
		{
			const string text = "Are you sure you want to delete this value?";
			const string caption = "Confirm Value Delete";
			return ( MessageBox.Show(text,caption,MessageBoxButtons.YesNo,MessageBoxIcon.Exclamation) == DialogResult.Yes );
		}

		private void mnuItemModify_Click(object sender, System.EventArgs e)
		{
			listView_DoubleClick( null , null );
		}

		private void contextMenu1_Popup(object sender, System.EventArgs e)
		{
			mnuNew.Visible = ( _currentSection != null );

			bool showModifyAndDelete = (listView.SelectedItems.Count > 0);
			mnuItemDelete.Visible = showModifyAndDelete;	
			mnuItemModify.Visible = showModifyAndDelete;
		
		}

		private void mnuInsertConfigSection_Click(object sender, System.EventArgs e)
		{
			if ( _currentConfiguration != null )
			{
				string sectionName = Microsoft.VisualBasic.Interaction.InputBox("Section Name :","Edit Configuration Section",null, -1, -1 );
				if (sectionName != null && sectionName.Trim().Length > 0 && ! _currentConfiguration.Sections.Contains (sectionName) )
				{
					ConfigurationSection section = _currentConfiguration.Sections.Add( sectionName );
					UltraExplorerBarItem item = explorerBar.Groups[_currentConfiguration.Name].Items.Add( section.Name, section.Name );
					item.Active = true;
					LoadViewsWithDetails ( section );
				}
			}
		}

		private void explorerBar_Click(object sender, EventArgs e)
		{
			if ( explorerBar.ActiveGroup != null )
				_currentConfiguration = explorerBar.ActiveGroup.Tag as Configuration;
		}

		private void explorerBar_ActiveGroupChanged(object sender, GroupEventArgs e)
		{
			_currentConfiguration = e.Group.Tag as Configuration;
		}

		private void contextMenu2_Popup(object sender, System.EventArgs e)
		{
			mnuDeleteConfigItem.Visible = ( explorerBar.ActiveItem != null );
		}

		private void listView_KeyDown(object sender, KeyEventArgs e)
		{
			switch ( e.KeyCode )
			{
				case  Keys.Enter:
					listView_DoubleClick ( sender, null );
					break;
				case Keys.Escape:
					Up_ToolClick ( null, null );
					break;
				case Keys.Delete:
					mnuItemDelete_Click ( null, null );
					break;
			}
		}

		private void leftNavTree_DoubleClick(object sender, EventArgs e)
		{
			if ( leftNavTree.SelectedNodes.Count > 0 )
				LoadViewsWithDetails ( leftNavTree.SelectedNodes[0].Tag );
		}
	}
}
	